Re: [SQL] SubQuery speed
От | Herouth Maoz |
---|---|
Тема | Re: [SQL] SubQuery speed |
Дата | |
Msg-id | l03110703b21af7eb7bd6@[147.233.159.109] обсуждение исходный текст |
Ответ на | SubQuery speed (andreas.fredriksson@pacer.se) |
Список | pgsql-sql |
At 16:45 +0200 on 8/9/98, andreas.fredriksson@pacer.se wrote: > Are there any alternate methods of solving this? I don't think it's > possible to write this kind of query using a multi-JOIN? Why not? So long as the query is "in", and not "not in"? Should be something like: SELECT DISTINCT url,title FROM idx_files, idx_ref, idx_words WHERE idx_files.id = idx_ref.file_id AND idx_ref.word_id = idx_words.id AND (idx_words.word = 'search term 1' OR .. ); In any case, are there indices on the appropriate fields? If the innermost query is supposed to return only one tuple, you should use "=" rather than IN, although I don't know how much that adds. The optimizer probably has an easier time with "=" than with IN. Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma
В списке pgsql-sql по дате отправления: